import { message } from "antd"
import { Navigate } from "react-router-dom"
import { getToken } from "../utils"


function AuthComponent ({ children }) {
  const isToken = getToken()
  if (isToken) {
    return <>{children}</>
  } else {
    message.error('请登录')
    return <Navigate to='/login' replace ></Navigate>
  }
}
export {
  AuthComponent
}